<?php

$repPath = str_replace("\\", "/", dirname($_SERVER['SCRIPT_FILENAME']) . '/');
$repPath = str_replace("/public", "", $repPath);

// 初始化常量
defined('ROOT') or define('ROOT', __DIR__ . '/');
defined('APP_PATH') or define('APP_PATH', $repPath);
defined('APP_DEBUG') or define('APP_DEBUG', false);
defined('CONFIG_PATH') or define('CONFIG_PATH', APP_PATH . 'config/');
defined('RUNTIME_PATH') or define('RUNTIME_PATH', APP_PATH . 'runtime/');
defined('TPL_PATH') or define('TPL_PATH', APP_PATH . 'tpl/');

if (!is_dir(RUNTIME_PATH)) {
    mkdir(RUNTIME_PATH);
}
if (!is_dir(TPL_PATH)) {
    mkdir(TPL_PATH);
}
if (!is_dir(CONFIG_PATH)) {
    mkdir(CONFIG_PATH);
}

require '../vendor/autoload.php';

// 类文件扩展名
const EXT = '.class.php';
const NORMAL_EXT = '.php';

// 包含配置文件
require APP_PATH . 'config/config.php';

define('LOG_PATH', RUNTIME_PATH . LogDir);
define('DB_LOG_PATH', RUNTIME_PATH . LogDir . '/' . DB_LOG);

// 包含核心框架类
require ROOT . 'Core.php';

// 实例化核心类
$fast = new Fast;
$fast->run();